package com.neu.niuyuchao.servlet;

import com.neu.niuyuchao.service.MgrApproveService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "ReturnApplyServlet", urlPatterns = {"/ReturnApplyServlet.do"})
public class ReturnApplyServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
     request.setCharacterEncoding("utf-8");
     String appro_id=request.getParameter("appro_id");
//       System.out.println(appro_id);
     MgrApproveService mgrApproveService=new MgrApproveService();
     boolean flag=mgrApproveService.doUpdateApplyStatus(appro_id);
     if(flag){
          response.sendRedirect(request.getContextPath()+"/commons/success.jsp");
     }else{
         response.sendRedirect(request.getContextPath()+"/commons/fail.jsp");
     }

}

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
